#ifndef __CUST_TIMER_H__
#define __CUST_TIMER_H__
#include "CApi.h"

struct Timer_InfoStruct
{
	uint32_t TargetSec;
	uint32_t AddSec;
	uint16_t TargetMsec;
	uint16_t AddMsec;
	MyCBFun_t CallBack;
	PV_Union Param;
	uint8_t Work;
	uint8_t ToFlag;
	uint8_t Mode;
	uint8_t ID;
	struct Timer_InfoStruct *Next;
};
typedef struct Timer_InfoStruct Timer_t;

typedef struct
{
	uint32_t Sec;
	uint16_t Msec;
	uint8_t Irq;
	uint8_t IDSn;
	Timer_t *Head;
}Timer_CtrlStruct;
/*********************************TimerList*****************************************/

void Timer_Init(void);
void Timer_Task(PV_Union Param);
void Timer_Run(void);
int Timer_Register(Timer_t *Timer, MyCBFun_t CB, void *Param);
int Timer_Start(Timer_t *Timer, uint32_t ToSec, uint32_t ToMsec, uint8_t IsRepeat);
void Timer_Switch(Timer_t *Timer, uint8_t OnOff);
void Timer_Restart(Timer_t *Timer, uint32_t ToSec, uint32_t ToMsec);
void Timer_Del(Timer_t *Timer);
void Timer_GetTimeFromPoweron(uint32_t *Sec, uint32_t *Msec);
#endif
